<!DOCTYPE html> <html>
<head>
<title>Items</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=Edge，chrome=1">
<link href="/jscss/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
  <div class="container">
      
<blockquote>汉字的拼音首字母</blockquote>
引用<code>pinyin.js</code><br/>
调用ciyext_pinyin_first(str)函数，返回不带多音字信息的拼音首字母。<br/>
调用ciyext_pinyin_arr(str)函数，返回带多音字信息的拼音首字母集合。<br/>

<br/>

<blockquote>示例代码</blockquote>
<pre>
&lt;script src="/jscss/pinyin.js" type="text/javascript"></script>
var str = '自行车';
var pinyin = ciyext_pinyin_first(str);
console.log(pinyin);//ZXJ
var pinyins = ciyext_pinyin_arr(str);
console.log(pinyins);//["Z", "XH", "JC"]
</pre>

<blockquote>运行</blockquote>

    输入汉字:
    <input type="text" name="gbstr" value="CIYPHP精简框架 自行车"/>
    <button class='btn' onclick='pfirst()'>pinyin_first</button>
    <button class='btn' onclick='parr()'>pinyin_arr</button>
<br/>
<div id='gbresult'></div>

  </div>
<script src="/jscss/jquery-1.12.4.min.js"></script>
<script src="/jscss/ciy.js"></script>
<script src="/jscss/pinyin.js"></script>
<script type="text/javascript">
'use strict';
$(function(){
});
function pfirst()
{
    var str = document.getElementsByName('gbstr')[0].value;
    document.getElementById("gbresult").innerHTML=ciyext_pinyin_first(str);
    console.log(ciyext_pinyin_first(str));
}
function parr()
{
    var str = document.getElementsByName('gbstr')[0].value;
    document.getElementById("gbresult").innerHTML=ciyext_pinyin_arr(str);
    console.log(ciyext_pinyin_arr(str));
}
</script>
</body></html>